from xml.parsers.expat import ParserCreate

class MySaxHandler(object):
	def start_element(self, name, attrs):
		print("sax: start_element: %s, attrs: %s" % (name, str(attrs)))

	def end_element(self, name):
		print("sax: end_element: %s" % name)

	def char_data(self, text):
		print("sax: char_data: %s" % text)


xml = ""
with open("ac2sql.config", "r", encoding="utf-8") as f:
	xml = f.read()


handler = MySaxHandler()
parser = ParserCreate()
parser.StartElementHandler = handler.start_element
parser.EndElementHandler = handler.end_element
parser.CharacterDataHandler = handler.char_data
parser.Parse(xml)

